<?php if (!defined('THINK_PATH')) exit();?><!-- $Id: brand_info.htm 14216 2008-03-10 02:27:21Z testyang $ -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>ECSHOP 管理中心 - 修改分类 </title>
    <meta name="robots" content="noindex, nofollow">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/Public/Styles/general.css" rel="stylesheet" type="text/css" />
    <link href="/Public/Styles/main.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="/Public/Js/jquery.js"></script>
</head>
<body>
    <h1>
        <span class="action-span"><a href="/Goods/Category/lst">分类列表</a></span>
        <span class="action-span1"><a href="#">ECSHOP 分类中心</a></span>
        <span id="search_id" class="action-span1"> - 修改分类 </span>
        <div style="clear:both"></div>
    </h1>
    <div class="main-div">
        <form method="post" action="/Goods/Category/add" enctype="multipart/form-data" >

            <table cellspacing="1" cellpadding="3" width="100%">
                <tr>
                    <td class="label">上级分类:</td>
                    <td>
                        <select name="parent_id">
                            <option value="0">顶级栏目</option>
                            <?php foreach($category as $c):?>
                                <option value="<?php echo $c['id']?>"><?php echo str_repeat('--',$c['level']*2).$c['cat_name']?></option>

                            <?php endforeach;?>
                        </select>    
                    </td>
                </tr>
                <tr>
                    <td class="label">分类名称:</td>
                    <td>
                        <input type="text" name="cat_name" maxlength="60" />
                        <span class="require-field">*</span>
                    </td>
                </tr>
                <tr>
                    <td class="label">推荐到：</td>
                    <td>
                     <?php foreach($recommend as $r):?>
                         <input type='checkbox' name="rec[]" value='<?php echo $r["id"]?>'><?php echo $r['rec_name']?>
                     <?php endforeach;?>

                 </td>
             </tr>
             <tr>
                <td class="label">筛选属性：</td>
                <td width="10px">
                 <select id="type">
                     <option value="0">请选择筛选属性类型</option>
                     <?php foreach ($type as $k2 => $v2):?> 
                         <option value="<?php echo $v2['id'];?>"><?php echo $v2['type_name'];?></option>
                     <?php endforeach;?>
                 </select>

             </td>
             <td>
                 <select name="filter_goods_attr_id">
                     <option value="0">请选择筛选属性</option>
                 </select>

             </td>
         </tr>
         <tr>
            <td colspan="2" align="center"><br />
                <input type="submit" class="button" value=" 确定 " />
                <input type="reset" class="button" value=" 重置 " />
            </td>
        </tr>
    </table>

</form>
</div>

<div id="footer">
    共执行 1 个查询，用时 0.018952 秒，Gzip 已禁用，内存占用 2.197 MB<br />
    版权所有 &copy; 2005-2012 高端大气上档次有限公司，并保留所有权利。</div>
</body>
</html>
<script type="text/javascript">
    $('#type').change(function(){
        $.post("/Goods/Category/ajaxGetAttr",{id:this.value},getAttr);
    });

    function getAttr(value){
        if(value){
            var data=eval('('+value+')');
            var sel=$("select[name='filter_goods_attr_id']");
            sel.html('<option value="0">请选择筛选属性</option>');
            for(var i in data){
                var arr=data[i]['attr_name'].split(',');
                console.log(arr);
                for(var j=0;j<arr.length;j++){
                    var str=$("<option value='"+data[i]['id']+"'>"+arr[j]+"</option>");
                    sel.append(str);
                }
            }
        }
    }
</script>